home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
listings
/
v_10_06
/
1006018a
< prev
next >
Wrap
Text File
|
1992-04-07
|
352b
|
17 lines
/* calloc function */
#include <stdlib.h>
#include <string.h>
void *(calloc)(size_t nelem, size_t size)
{ /* allocate a data object on the heap and clear it
*/
const size_t n = nelem * size;
char *p = (char *)malloc(n);
if (p)
memset(p, '\0', n);
return (p);
}